package com.yjhh.scala

/**
  *
  *
  *
  */
object HelloImplicitsByImport {

  class Man(val name: String)

  object implicits {
    //假如了隐式转化就可以调用SuperMan中的方法了
    implicit def man2SuperMan(man: Man) = new SuperMan(man.name)
  }

  class SuperMan(val name: String) {
    def makeMiracles = println(this.name + "Wow,Wow,Wow...")
  }

  def main(args: Array[String]): Unit = {
    //通过导入包的方式手动导入进行隐式转化
    //import implicits._

    implicit def man2SuperMan(man: Man) = new SuperMan(man.name)
    new Man("Scala").makeMiracles
  }

}
